package de.projectgoodmorning.util;

public class ArgsValidator {

	public static void isNotNull( Object obj, String argName ) {
		if( obj == null ) {
			if( argName != null )
				throw new IllegalArgumentException( "The argument '" + argName + "' is null" );
			else
				throw new IllegalArgumentException( "The passed on argument is null" );
		}
	}
	
	public static void isNotEmpty( Object obj, String argName ) {
		if( obj == null ) {
			if( argName != null )
				throw new IllegalArgumentException( "The argument '" + argName + "' is empty" );
			else
				throw new IllegalArgumentException( "The passed on argument is empty" );
		}
	}
	
	public static void isNotNullAndNotEmpty( String obj, String argName ) {
		if( obj == null || obj.isEmpty() ) {
			if( argName != null )
				throw new IllegalArgumentException( "The argument '" + argName + "' is null or empty" );
			else
				throw new IllegalArgumentException( "The passed on argument is null or empty" );
		}
	}
}
